<!-- sua bai viet-->
<?php echo validation_errors(); ?>

<form method="POST" action="<?php echo base_url().'admin/xuly/duan/list/'.$this->uri->segment(5);?>">
    <div class="box_heading">
        <div class="icon">
        <img src="<?php echo base_url().'template/admin/images/icon_settings.png';?>"/> Sửa Tin tức ( <span style="color: red;"> * : không được để trống</span> )  <?php if(!empty($thongbao)){echo '<img src='.base_url().'template/admin/images/ok.png class="ok"><font color=red><b>'.$thongbao.'</b></font>';}?>
        </div>
        <div class="right">    
        <a href="<?php echo base_url().'admin/xuly/duan';?>">Hủy</a>
        </div>
    </div>
    
    <div class="box_noidung">
        <table class="form">
            <tr><td><font color=red>* </font>Tiêu đề</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->title;};?>" name="title"/></td></tr>
            <tr><td><font color=red>* </font>Alias</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->alias;};?>" name="alias"/>(Alias sẽ hiển thị trên url trình duyệt)</td></tr>
            <tr><td><font color=red>* </font>Danh mục</td><td>
                <select name="category">    
                <?php if($cat) {foreach ( $cat as $cat ){
                  echo '<option '; 
                  if(!empty($data)){if( $cat->id==$data->category )echo ' selected="selected" ';}
                  echo ' value='.$cat->id. '>'.$cat->title.'</option>';
                }}?>                                  
                   
                  
                </select> 
                </td></tr>
            <tr><td><font color=red>* </font>Trạng thái</td><td>
                <select name="publish">                                            
                  <option <?php if(!empty($data)){if($data->publish=='1')echo 'selected="selected"';} ?> value='1'>Hiện</option>';
                  <option <?php if(!empty($data)){if($data->publish=='0')echo 'selected="selected"';} ?> value='0'>Ẩn</option>';                                              
                </select> 
                </td></tr>
            <tr><td><font color=red>* </font>Ảnh đại diện</td><td>
                <input type="text" id="xFilePath" name="image"  size="53" class="medium" value="<?php if(!empty($data)){echo $data->image;} ?>" />
                <input type="button" value="Tải ảnh lên" onclick="BrowseServer();" style="background-color: #E5E3E3;background-image: url('../../resources/images/button.png')" />
            </td></tr>
            <tr><td></font>Meta Description</td><td><textarea rows="2" cols="40" name="metades"><?php if(!empty($data)){echo $data->metades;};?></textarea></td></tr>
            <tr><td></font>Meta Keywords</td><td><textarea rows="2" cols="40" name="metakey"><?php if(!empty($data)){echo $data->metakey;};?></textarea></td></tr>
            <tr><td><font color=red>* </font>Nội dung</td><td><textarea rows="5" cols="40" name="fulltext" id="soanthao"><?php if(!empty($data)){echo $data->fulltext;};?></textarea></td></tr>
            
            <tr><td><font color=red>* </font>Nổi bật</td><td>
                <select name="type">                                            
                  <option <?php if(!empty($data)){if($data->type=='1')echo 'selected="selected"';} ?> value='1'>Có</option>';
                  <option <?php if(!empty($data)){if($data->type=='0')echo 'selected="selected"';} ?> value='0'>Không</option>';                                              
                </select> 
                </td></tr>
            <tr><td> Thứ tự</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->order;}else echo '0';?>" name="order"/></td></tr>
            <tr><td style="text-align: center;" colspan="2"><input class="guidulieu" type="submit" value="Lưu"/></td></tr>
        </table>
    </div>
</form>
    <script type="text/javascript">
       if ( typeof CKEDITOR == 'undefined' ){
        	document.write("khong") ;
        }
        else{
        	var editor = CKEDITOR.replace( 'soanthao' );  
            var editor2 = CKEDITOR.replace( 'soanthao2' );           
            CKFinder.setupCKEditor( editor, '<?php echo base_url();?>ckeditor/ckfinder/' ) ;  
            CKFinder.setupCKEditor( editor2, '<?php echo base_url();?>ckeditor/ckfinder/' ) ;                  	
        }
    </script>
<!--end sua bai viet-->